#pragma once

#include <QDialog>
#include <QThread>
#include "CopyThread.h"
#include "ui_DlgCopyProgressbar.h"
#include "Drive.h"
#include "TreeItemDataDef.h"

class DlgCopyProgressbar : public QWidget
{
	Q_OBJECT

public:
	DlgCopyProgressbar(const QString &_qstrId, QWidget *parent = nullptr);
	~DlgCopyProgressbar();
	void StartCopyTask(TreeItem *_pSrc, TreeItem*_pDre);
	void SetId(const QString &_qstrTaskId) { m_qstrTaskId = _qstrTaskId; }
	QString GetId() { return m_qstrTaskId; }
	void *GetItemData(const TreeItem* _pItem);
	void GetFileSize(const QString &_qstrPPath, TreeItem* _pSrcItem, QMap<QString, TreeItem*> &_qmapFileList,uint64_t& _iSize, int& _iFiles);

signals:
	void SignCancel();
	void SignFinished();
	void SignNewFile(int _iType, File *_pDre);
	void SignUpdateFile(int _iType, File *_pDre);

public slots:
	void slotShowErrorMsg(QString _qstrMsg);

private:
	Ui::DlgCopyProgressbarClass ui;
	QThread m_workTread;
	CopyThread *m_pTask = nullptr;
	bool m_blCancel = false;
	QString m_qstrTaskId;
	
};
